package cn.edu.neusoft.maxingxin231.yuejian06.Adapter;

import android.content.Context;
import android.support.annotation.NonNull;
import android.support.v7.widget.RecyclerView;

import com.squareup.picasso.Picasso;

import java.util.List;

import cn.edu.neusoft.maxingxin231.yuejian06.Bean.CourseBean;

public class CourseAdapter extends CourseBaseAdapter<CourseBean>  {
    String id,course_name,course_img,difficulty,course_price;

    public CourseAdapter(Context context, List<CourseBean> items, int layoutResource) {
        super(context, items, layoutResource);
    }

    @Override
    public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
        CourseBean courseBean = (CourseBean)items.get(position);
        if (courseBean == null)return;
        CourseViewHolder courseViewHolder = (CourseViewHolder)holder;
        courseViewHolder.cu_2.setText(courseBean.getCourse_name());
        courseViewHolder.cu_3.setText(courseBean.getCourse_price());
        courseViewHolder.cu_4.setText(courseBean.getDifficulty());

        id = courseBean.getCoach_id();
        course_name = courseBean.getCourse_name();
        course_price = courseBean.getCourse_price();
        difficulty = courseBean.getDifficulty();
        Picasso.with(context).load("http://10.0.2.2:80/yuejian14/public/static/course/"+items.get(position).getCourse_img()).into(courseViewHolder.cu_1);
    }


    public void setList(List<CourseBean> list){
        this.items = list;
        notifyDataSetChanged();
    }

}
